package com.ktjy.mapper;

import com.sun.net.httpserver.HttpServer;

public abstract class TestServlet extends HttpServer {

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp)
            throws ServletException, IOException {
        req.setCharacterEncoding("UTF-8");
        this.doGet(req, resp);
        }

         @Override
 protected void doGet(HttpServletRequest req, HttpServletResponse resp)
            throws ServletException, IOException {
         resp.setCharacterEncoding("UTF-8");
         try {
             // SimpleBeanConvertor.convert 将请求 req 对象中的请求参数，
             // 在调用 User 实体类中的相关 set 方法后，赋值给 User 实体类中相关属性
             User user = SimpleBeanConvertor.convert(req, User.class);
             System.out.println(user);
             } catch (Exception e) {
             e.printStackTrace();
             }
         }
}




